home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Your Choice 3
/
Your Choice Software Collection 3.iso
/
os2
/
etelr21
/
frmtdate.vrm
< prev
next >
Wrap
Text File
|
1994-09-10
|
2KB
|
70 lines
/***********************************************/
/* VX-Rexx Macro to verify and format dates */
/* throughout E-Teller */
/* Please do not modify */
/***********************************************/
/* Custom mainline for macro */
call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
call VRLoadFuncs
_VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
if( _VREVersion < 2.02 )then do
call VRMessage "", "This program requires VX-REXX version 2.0b to run.", "Error!"
return 32000
end
signal on SYNTAX name _VRESyntax
signal _VREMain
_VRESyntax:
parse source . . _VRESourceSpec
call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
exit 32000
_VREMain:
/*:VRX Main
*/
Main:
parse upper arg date form
position = Pos( "/", date, 1 )
if position = 0 then
signal DateFormatError
if Pos( '/', date, position + 1 ) = 0 then
signal DateFormatError
if form = 'O' then
parse var date year '/' month '/' day
if form = 'E' then
parse var date day '/' month '/' year
if form = 'U' then
parse var date month '/' day '/' year
if month > 12 then
signal DateFormatError
if day > 31 then
signal DateFormatError
if Length( year ) = 1 then
year = '0'||year
if Length( month ) = 1 then
month = '0'||month
if Length( day ) = 1 then
day = '0'||day
if form = 'O' then
rc = year||'/'||month||'/'||day
if form = 'E' then
rc = day||'/'||month||'/'||year
if form = 'U' then
rc = month||'/'||day||'/'||year
call VRMethod 'Application', 'PutVar', 'rc'
exit
DateFormatError:
if form = 'O' then
call VRMessage "", "Incorrect date format -- yy/mm/dd ", "Warning"
if form = 'U' then
call VRMessage "", "Incorrect date format -- mm/dd/yy ", "Warning"
if form = 'E' then
call VRMessage "", "Incorrect date format -- dd/mm/yy ", "Warning"
rc = 'ERROR'
call VRMethod 'Application', 'PutVar', 'rc'
exit